package com.aoxin.mapper.client;

import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;

public interface RecentlyMadeReservationsDao {
	/**
	 * 查询课程表最近一条记录(根据孩子id)
	 * 
	 * @return
	 */
	List<Map<String, Object>> checkLimitCourse(@Param("childrenId") Integer childrenId);

	/**
	 * 查询是否有进行中的C类课
	 * 
	 * @param childrenId
	 * @return
	 */
	Integer queryIsOrderC(@Param("childrenId") Integer childrenId,@Param("startDate")String startDate);

	/**
	 * 查询教室ID结束时间
	 * 
	 * @return
	 */
	List<Map<String, Object>> queryRoomIdAndEndTime(@Param("startDate")String startDate);

	/**
	 * 查询有空余位教室课程id
	 * 
	 * @param classRooomId
	 * @param employTime
	 * @return
	 */
	Map<String,Object> queryFreePositionCourse(@Param("classRooomId") Integer classRooomId,
			@Param("employTime") String employTime);

	/**
	 * 查询课程数据
	 * 
	 * @param courseId
	 * @param schoolId
	 * @return
	 */
	Map<String, Object> queryCourseDetails(@Param("courseId") Integer courseId, @Param("schoolId") Integer schoolId);

	/**
	 * 查询热门且未购买课程包
	 * 
	 * @param schoolId
	 * @return
	 */
	List<Map<String, Object>> queryHotCoursePage(@Param("schoolId") Integer schoolId,
			@Param("childrenId") Integer childrenId);

	/**
	 * 插入一条排表数据
	 * 
	 * @param childrenId
	 * @param courseId
	 */
	Integer addEPOrder(@Param("childrenId") Integer childrenId, @Param("courseId") Integer courseId);

	/**
	 * 更新状态
	 * 
	 * @param courseId
	 * @param userId
	 * @return
	 */
	Integer updateState(@Param("id") Integer id, @Param("userId") Integer userId,
			@Param("state") Integer state);

	/**
	 * 查询一条最近排表数据
	 * 
	 * @param userId
	 * @return
	 */
	List<Map<String, Object>> queryLatestCourse(@Param("userId") Integer userId,@Param("courseId") Integer courseId);

	/**
	 * 扣除用户立方币
	 * 
	 * @param userLfb
	 * @param userId
	 */
	void updateUserLfb(@Param("userLfb") Double userLfb, @Param("userId") Integer userId);
	/**
	 * 	添加课程信息
	 * @param childrenId
	 * @param userId
	 * @param userName
	 * @param courseId
	 * @param schoolId
	 */
	void insertDataToMyCourse(@Param("childrenId") Integer childrenId,@Param("userId") Integer userId,@Param("userName") String userName,
			@Param("courseId") Integer courseId,@Param("schoolId") Integer schoolId);
	/**
	 * 更新我的课程状态
	 * @param shcoolCourseId
	 * @param childrenId
	 * @param state
	 */
	void updateMyCourse(@Param("shcoolCourseId") Integer shcoolCourseId, @Param("childrenId") Integer childrenId,
			@Param("state") Integer state);
	/**
	 * 查询学校课程包id
	 * @param shcoolCourseId
	 * @param schoolId
	 * @return
	 */
	Map<String,Object>querySchoolCoursePageId(@Param("schoolCourseId") Integer shcoolCourseId, @Param("schoolId") Integer schoolId);
	
	/**
	 * 查询有空余位置的课程
	 * @return
	 */
	List<Map<String,Object>>queryVacancyCourseDataCorBOrC(@Param("aa") Integer flag);
	/**
	 * 	查询该堂课程剩余人数
	 * @param courseId
	 * @param classRoomId
	 * @param employ_time
	 * @return
	 */
	Integer queryVacancyCourseNumber(@Param("courseId") Integer courseId, @Param("classRoomId") Integer classRoomId,@Param("employ_time")String employ_time);
	/**
	 * 查詢課程包id
	 * @param courseId
	 * @param schoolId
	 * @return
	 */
	Integer queryCoursePageId(@Param("courseId") Integer courseId,@Param("schoolId") Integer schoolId);
	
	/**
	 *  查詢課程包條數
	 * @param schoolCoursePageId
	 * @param childrenId
	 * @return
	 */
	Integer queryCoursePageAmountInMyCoursePage(@Param("schoolCoursePageId") Integer schoolCoursePageId,@Param("childrenId") Integer childrenId);
	/**
	 *  添加 CourseNumber数据 根据id
	 * @param courseId
	 * @param schoolCoursePageIds
	 * @param childrenId
	 * @return
	 */
	void insertCourseNumberData(@Param("courseConditionId") Integer courseConditionId);
	/**
	 * 查询user_course_condition数据
	 * @param courseConditionId
	 * @return
	 */
	Map<String,Object> queryCourseConditiion(@Param("courseConditionId") Integer courseConditionId);
	
	/**
	 * 删除 courseCondition数据
	 * @param courseConditionId
	 */
	Integer deleteCourseConditionId(@Param("courseConditionId") Integer courseConditionId);
	/**
	 * 添加CourseNumber数据 根据courseid
	 * @param courseId
	 */
	void  insertCourseNumberByCourseId(@Param("courseId") Integer courseId,@Param("childrenId") Integer childrenId);
}
